import api from "../api";
import {getToken} from '../auth.js'

const travelInfoList = function (params) {
  return api.postRequest(api.requestURL + `travel/info/travelInfoList`, params, false, {'Content-Type': 'application/json'})
}

// 旅游产品详情
const getTravelInfoDetail = function (params) {
  return api.getRequest(api.requestURL + `travel/info/travelInfoDetail`, params)
}

// 新增旅游产品
const addTravelInfo = function (params) {
  return api.postRequest(api.requestURL + `travel/info/addTravelInfo`, params, false, {'Content-Type': 'application/json'})
}

// 修改旅游产品
const updateTravelInfo = function (params) {
  return api.postRequest(api.requestURL + `travel/info/updateTravelInfo`, params, false, {'Content-Type': 'application/json'})
}

// 删除
const delTravel = function (params) {
    return api.postRequest(api.requestURL + `travel/info/deleteTravelInfo`, params, false, {'Content-Type': 'application/json'})
  }


// 获取产品列表
const getTravelType = function (params) {
  return api.getRequest(api.requestURL + `travel/common/getTravelType`, params)
}

// 删除分类
const deleteTravelType = function (params) {
  return api.postRequest(api.requestURL + `travel/common/deleteTravelType`, params, false, {'Content-Type': 'application/json'})
}

// 新增分类
const addTravelType = function (params) {
  return api.postRequest(api.requestURL + `travel/common/addTravelType`, params, false, {'Content-Type': 'application/json'})
}

// 修改分类
const updateTravelType = function (params) {
  return api.postRequest(api.requestURL + `travel/common/updateTravelType`, params, false, {'Content-Type': 'application/json'})
}


// 设为轮播
const updateSlideShow = function (params) {
  return api.postRequest(api.requestURL + `travel/picture/updateSlideShow`, params, false, {'Content-Type': 'application/x-www-form-urlencoded'})
}

export default {
  travelInfoList,
  addTravelInfo,
  updateTravelInfo,
  getTravelInfoDetail,
  getTravelType,
  addTravelType,
  delTravel,
  updateTravelType,
  deleteTravelType,
  updateSlideShow
}
